<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link href="/static/admin/public/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/static/admin/public/css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="/static/toastr/toastr.min.css" rel="stylesheet"></link>
    <link href="/static/admin/public/css/animate.min.css" rel="stylesheet">
    <link href="/static/admin/public/css/style.min.css?v=3.2.0" rel="stylesheet">
    <link href="/static/admin/public/css/breeze_admin.css?v=1.1.0" rel="stylesheet">
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>

</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name">H+</h1>

        </div>
        <h3>登录</h3>

        <form class="m-t" role="form" id="loginID">
            <div class="form-group">
                <input type="text" class="form-control" placeholder="用户名" required="required" name="username" value="username" v-model="username">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" required="required" minlength="2"  name="password" value="password" placeholder="密码" v-model="password">
            </div>
<!--            <div class="form-group">-->
<!--                <input type="captcha" class="form-control" placeholder="验证码" v-model="captcha">-->
<!--                <div>{:captcha_img('','',100,50)}</div>-->
<!--            </div>-->
            <button type="button" class="btn btn-primary block full-width m-b" @click="loginIn()">登 录</button>
<!--            <p class="text-muted text-center"> <a href="login.html#"><small>忘记密码了？</small></a> | <a href="register.html">注册一个新账号</a>-->
            </p>

        </form>
    </div>
</div>

<!-- 全局js -->
<script src="/static/admin/public/js/jquery-2.1.1.min.js"></script>
<script src="/static/admin/public/js/bootstrap.min.js?v=3.4.0"></script>
<script src="/static/toastr/toastr.min.js"></script>
<script src="/static/toastr/customToastr.js"></script>
<script type="text/javascript" src="/static/vue/vue.js"></script>
<script type="text/javascript" src="/static/util/axios.min.js"></script>
<!--<script type="text/javascript" src="/static/admin/api/login.js"></script>-->
<!--自定义js-->
<script type="text/javascript" src="/static/admin/api/require.js"></script>
<script type="text/javascript" src="/static/admin/api/login.js"></script>

<!--第三方插件-->
<script type="text/javascript" src="/static/util/validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="/static/util/validate/messages_zh.min.js"></script>
<script type="text/javascript">


    var login = new Vue({
        el:"#loginID",
        data:{
            "username":"",
            "password":"",
            "isPost":'true'
        },

        methods:{
            loginIn:function () {
                var el = this;

                var postArray = {
                    "username":el.username,
                    "password":el.password,
                }
                if($("#loginID").valid()){
                    if(el.isPost){
                        el.isPost = false
                        loginDo(postArray).then((response)=>{
                            console.log(response)
                            $.customToastr('success',response.message)
                            setTimeout(()=>{
                                window.location.href="/admin/index"
                            },1000)

                        }).catch(()=>{
                            el.isPost = true
                        })
                    }


                }
            }


        }
    });

</script>

</body>

</html>